基于Java spring + vue3 + nuxt构建的内容管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

76 lines
2.2 KiB

<template>
<div class="banner" v-if="form">
<el-image :src="form.photo"></el-image>
</div>
<div v-if="form" class="container flex flex-col w-[1280px] m-auto my-3">
<el-breadcrumb class="py-2" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.name }}</el-breadcrumb-item>
</el-breadcrumb>
<div :title="`标题${form.name}`" class="w-7xl m-auto mt-10">
<template v-for="(item,index) in design?.data">
<div class="title text-3xl text-center">{{ item.name }}</div>
<div v-html="item.content">
</div>
</template>
</div>
<div class="flex flex-wrap justify-between w-[1280px] m-auto my-3">
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
</div>
</div>
<div v-if="!form">
<el-empty description="404 页面不存在"></el-empty>
</div>
</template>
<script setup lang="ts">
import type {Design} from "~/api/cms/design/model";
import type {ApiResult} from "~/api";
import {useRequest} from "~/composables/useRequest";
const route = useRoute();
const { query, params } = route;
const { name: productName } = params;
console.log(productName,'productName..')
// 页面信息
const form = ref<Design | any>();
// 请求数据
const { data: design } = await useRequest<ApiResult<Design[]>>('/cms/design', {params: {
path: `/${productName}`
}})
if (design.value) {
design.value?.data?.map((d,i) => {
if(i == 0){
form.value = d;
useHead({
title: form.value.name + "Nuxt3学习实践 ~ 坚持",
meta: [{ name: "keywords", content: "Nuxt Vue SSR Typescript" }],
bodyAttrs: {
class: "page-container",
},
script: [
{
children: "console.log('Hello World')",
},
],
});
}
})
}
</script>
<style scoped lang="scss">
</style>